package type.proxy;

import java.lang.reflect.Proxy;

/**
 * @Date 2021/5/2 11:00 上午
 * @Author dengxin
 */
public class MethodDynamicProxyTest {

    private static void consume(SomeMethod obj) {
        obj.boring1();
        obj.boring2();
        obj.interesting();
        obj.boring4();
    }

    public static void main(String[] args) {
        SomeMethod proxy = (SomeMethod) Proxy.newProxyInstance(DoSomething.class.getClassLoader(),
                new Class[]{SomeMethod.class}, new MethodDynamicProxyHandler(new RealSomeMethod()));
        consume(proxy);
    }
}
